﻿<%@ Page Title="" Language="C#" MasterPageFile="~/resumemanager/resume.master" %>

<%@ Import Namespace="TalentPools.Model" %>
<%@ Import Namespace="TalentPools.BLL" %>
<script runat="server">
    List<intention> list = null;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["userid"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }

            string resumeId = Request.QueryString["resumeId"];
            ViewState["resumeId"] = resumeId;
            if (resumeId == null || resumeId == "")
            {
                Response.Redirect("~/Default.aspx");
            }
            ddlJobCatagory.DataSource = new baseConfigManager().getconfigInfo("工作性质");
            ddlJobCatagory.DataTextField = "value";
            ddlJobCatagory.DataValueField = "value";
            ddlJobCatagory.DataBind();

            ddlCurrentState.DataSource = new baseConfigManager().getconfigInfo("目前状态");
            ddlCurrentState.DataTextField = "value";
            ddlCurrentState.DataValueField = "value";
            ddlCurrentState.DataBind();

            ddlsalary.DataSource = new baseConfigManager().getconfigInfo("薪资");
            ddlsalary.DataTextField = "value";
            ddlsalary.DataValueField = "value";
            ddlsalary.DataBind();

            ddljob.DataSource = new baseConfigManager().getconfigInfo("职位");
            ddljob.DataTextField = "value";
            ddljob.DataValueField = "value";
            ddljob.DataBind();

        }
        list = new alertResumeManager().getintentionByid(ViewState["resumeId"].ToString());
        if (list.Count == 1)
        {
            intention inten = list[0];

            txtjobarea.Text = inten.area;
            ddlJobCatagory.SelectedItem.Value = inten.jobCategory.ToString();
            ddljob.SelectedItem.Value = inten.profession.ToString();
            txthang.Text = inten.industry;
            ddlsalary.SelectedItem.Value = inten.pay.ToString();
            ddlCurrentState.SelectedItem.Value = inten.state.ToString();
        }
    }

    protected void imbtnnext_Click(object sender, ImageClickEventArgs e)
    {
        intention inte = new intention();
        inte.jobCategory = ddlJobCatagory.SelectedValue;
        inte.pay = ddlsalary.SelectedValue.ToString();
        inte.resumeId = ViewState["resumeId"].ToString();
        inte.state = ddlCurrentState.SelectedValue.ToString();
        inte.industry = txthang.Text.ToString();
        inte.profession = ddljob.SelectedValue.ToString();
        inte.area = txtjobarea.Text.ToString();
        bool result = false;
        if (list.Count==0)
        {
            result = new CreateresumeManager().createIntention(inte);
        }
        else
        {
            result = new alertResumeManager().updatinteByid(inte);
        }
        if (result)
        {
            WebManager.BasePage.JsWindows("修改成功!", "");
            Response.Redirect("Default.aspx");
        }
    }
</script>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table class="tableMain">
        <tr>
            <td class="titleStyle">
                求职类型:
            </td>
            <td class="textStyle">
                <asp:DropDownList ID="ddlJobCatagory" runat="server">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td class="titleStyle">
                工作地点:
            </td>
            <td class="textStyle">
                <asp:TextBox ID="txtjobarea" runat="server" ValidationGroup="secod" BorderStyle="None"
                    Width="195px"></asp:TextBox>
            </td>
            <td class="valStyle">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator15" runat="server" ControlToValidate="txtjobarea"
                    Display="Dynamic" ErrorMessage="*必填" ValidationGroup="secod"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="titleStyle">
                职业:
            </td>
            <td class="textStyle">
                <asp:DropDownList runat="server" ID="ddljob" Width="195px">
                </asp:DropDownList>
            </td>
            <td class="valStyle">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" ControlToValidate="ddljob"
                    Display="Dynamic" ErrorMessage="*必填" ValidationGroup="secod"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="titleStyle">
                行业:
            </td>
            <td class="textStyle">
                <asp:TextBox ID="txthang" runat="server" ValidationGroup="secod" BorderStyle="None"
                    Width="195px"></asp:TextBox>
            </td>
            <td class="valStyle">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" ControlToValidate="txthang"
                    Display="Dynamic" ErrorMessage="*必填" ValidationGroup="secod"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="titleStyle">
                薪资:
            </td>
            <td class="textStyle">
                <asp:DropDownList ID="ddlsalary" runat="server" Width="100px">
                </asp:DropDownList>
                (元)/月
            </td>
            <td class="valStyle">
            </td>
        </tr>
        <tr>
            <td class="titleStyle">
                目前状态:
            </td>
            <td class="textStyle">
                <asp:DropDownList ID="ddlCurrentState" runat="server" Width="195px">
                </asp:DropDownList>
            </td>
            <td class="valStyle">
            </td>
        </tr>
        <tr>
            <td colspan="3">
                <asp:ImageButton ID="imbtnnext" runat="server" ImageUrl="~/img/create.gif" OnClick="imbtnnext_Click" />
            </td>
        </tr>
    </table>
</asp:Content>
